const argvs = process.argv.slice(3);
const exec = require('child_process').execSync;
const commandType = process.argv[2];
argvs.push('login','home')//默认加入打包
const commandObj = {
  dev: {
    run : 'vue-cli-service serve',
    env : {
      packModules: argvs.join(',')
    }
  },
  build: {
    run : 'vue-cli-service build',
    env : {
      packModules: argvs.join(',')
    }
  },
  uniapp: {
    run : 'vue-cli-service build --mode uniapp',
    env : {
      packModules: argvs.join(',')
    }
  }
};
const command = commandObj[commandType];
if(!command){
  console.error('运行错误')
  return;
}
const result = exec(command.run, {
  stdio: 'inherit',
  env: {...process.env,...command.env}
});
console.log(result)